package com.example.myandroidapp1;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Menu extends ListActivity {

	List<String> classList;

	private void initClassList() {
		classList = new ArrayList<String>();
		classList.add("MainActivity");
		classList.add("TextPlay");
		classList.add("Email");
		classList.add("Camera");
		classList.add("MyGallery");
		classList.add("GridViewActivity");
		classList.add("Get");
		classList.add("GalleryViewActivity");
		classList.add("StatusBarActivity");
		classList.add("SimpleBrowser");
		classList.add("FullScreenBrowser");
		classList.add("Flipper");
		classList.add("GFX");
		classList.add("GFXSurface");
		classList.add("SoundStuff");
		classList.add("Slider");
		classList.add("Tabs");
		classList.add("MapActivity");


		classList.add("SharedPrefs");
		classList.add("InternalData");
		classList.add("Accelerate");
		classList.add("InternalData");
		classList.add("InternalData");

		
		classList.add("Email");
		classList.add("Email");
		classList.add("ExternalData");
		classList.add("SqlLiteExample");
		

	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initClassList();
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setListAdapter(new ArrayAdapter<String>(Menu.this,
				android.R.layout.simple_list_item_1, classList));
	}

	@SuppressWarnings("rawtypes")
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		try {
			Class ourClass = Class.forName("com.example.myandroidapp1."
					+ classList.get(position));
			Intent ourIntent = new Intent(Menu.this, ourClass);
			startActivity(ourIntent);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	@Override
	protected void onPause() {
		super.onPause();
		//finish();
	}
}
